//package com.duanjw.springcloud.gateway.config;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.springdoc.core.GroupedOpenApi;
//import org.springdoc.core.SwaggerUiConfigParameters;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.cloud.client.discovery.DiscoveryClient;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Lazy;
//
//import io.swagger.v3.oas.models.Components;
//import io.swagger.v3.oas.models.OpenAPI;
//import io.swagger.v3.oas.models.info.License;
////import lombok.extern.slf4j.Slf4j;
//
//@Configuration
////@Slf4j
//public class SwaggerConfig {
//
//    @Bean
//    @Lazy(false)
//    public List<GroupedOpenApi> apis(SwaggerUiConfigParameters swaggerUiConfigParameters, DiscoveryClient discoveryClient) {
//        List<GroupedOpenApi> groups = new ArrayList<>();
////        log.info("服务列表："+discoveryClient.getServices().toString());
//        discoveryClient.getServices().forEach(e->{
//            swaggerUiConfigParameters.addGroup(e);
//            GroupedOpenApi build = GroupedOpenApi.builder().pathsToMatch("/" + e + "/**").group(e).build();
//            groups.add(build);
//        });
//        return groups;
//    }
//
//    @Bean
//    public OpenAPI customOpenAPI() {
//        return new OpenAPI()
//                .components(new Components())
//                .info(new io.swagger.v3.oas.models.info.Info().title("Gateway API")
//                        .license(new License().name("Apache 2.0").url("http://springdoc.org")));
//    }
//}